package 七月七.青岛大学;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

public class QDU {
    public static void main(String[] args) throws IOException {
        Connection connect = Jsoup.connect("http://jdxy.qdu.edu.cn/szdw/js.htm");
        Document post = connect.post();
        Elements uU9Imgcontent = post.getElementsByTag("a");
        for (Element element : uU9Imgcontent) {
            String attr = element.attr("href");
            if (attr.length() == 21) {
                String substring = attr.substring(3, attr.length());
                Connection connect1 = Jsoup.connect("http://jdxy.qdu.edu.cn/" + substring);
                Document post1 = connect1.post();
                for (Element contentTitle : post1.getElementsByClass("content_title")) {
                    String text = contentTitle.text();
                    String substring1 = text.substring(0, 3);
                    System.out.println(substring1);
                }
//                for (Element vNewsContent : post1.getElementsByClass("v_news_content")) {
//                    for (Element div : vNewsContent.getElementsByTag("div")) {
//                        Elements p = div.getElementsByTag("p");
//                        int last = p.size() - 1;
//                        System.out.println(p.get(last - 1).text());
//                        System.out.println(p.get(last - 2).text());
//                        System.out.println("/////////////");
//
//
//                    }
////
//                }


            }

        }

    }
}
